package com.simpleFactory;

public class OperationFactory {
    public static Operation createOperate(String operate){
        Operation oper = null;
        switch (operate){
            case "+":
                oper = new OperationAdd();
                break;
            case "-":
                oper = new OperationSub();
                break;
            case "*":
                oper = new OperationMul();
                break;
            case "/":
                oper = new OperationDiv();
                break;
        }
        return oper;
    }

    public static void main(String[] args) throws Exception {
        Operation oper;
        oper = OperationFactory.createOperate("+");
        oper._numberA=1;
        oper._numberB=2;
        double result = oper.getResult();
    }
}
